package com.ruoyi.web.studentmanagementsystem.service.impl;

import com.ruoyi.web.studentmanagementsystem.dto.*;
import com.ruoyi.web.studentmanagementsystem.mapper.SysTeacherMapper;
import com.ruoyi.web.studentmanagementsystem.pojo.SysTeacher;
import com.ruoyi.web.studentmanagementsystem.service.ISysTeacherService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * ClassName: SysStudentServiceImpl
 * Package: com.ruoyi.web.studentmanagementsystem.service.impl
 * Description:老师管理 服务实现
 *
 * @Author Mr. o
 * @Create 2023/11/8 10:40
 * @Version 1.0
 */
@Service
public class SysTeacherServiceImpl implements ISysTeacherService
{
    @Resource
    private SysTeacherMapper teacherMapper;



    /**
     * 新增保存老师信息
     *
     * @param teacher 老师信息
     * @return
     */
    @Override
    @Transactional
    public void insertTeacher(ISysTeacherDTO teacher) {
        teacher.setCreateTime(new Date());
        teacherMapper.insertTeacher(teacher);
    }

    /**
     * 删除学生信息
     *
     * @param teacherId 老师ID
     * @return
     */
    @Override
    @Transactional
    public void deleteTeacherId(String teacherId) {
        teacherMapper.deleteTeacherId(teacherId);
    }

    /**
     * 根据老师姓名查询信息
     *
     * @param teacherName 老师姓名
     * @return
     */
    @Override
    @Transactional
    public List<SysTeacher> selectTeacherName(String teacherName) {
        return teacherMapper.selectTeacherName(teacherName);
    }

    /**
     * 修改保存老师信息
     *
     * @param teacher 老师信息
     * @return
     */
    public void updateTeacher(IISysTeacherDTO teacher) {
        teacher.setUpdateTime(new Date());
        teacherMapper.updateTeacher(teacher);
    }
}
